<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>鼠标跟随效果</title>
    <style type="text/css">
        body{
            height: 1500px;
            background-color: black;
        }
        img{
            position: absolute;
            top: 0;
            left: 0;
        }
    </style>
</head>
<body>
    <img src="img/girl.gif" id="image">
<script type="text/javascript">
    var image=document.getElementById("image");
    window.onmousemove=function (ev) {
        var ev=ev||window.event;
        image.style.top=(ev.pageY-100)+"px";
        image.style.left=(ev.pageX-100)+"px";
    }



</script>
</body>
</html>